<?php

namespace app\controller\admin;

use app\base\BaseEncryptController;
use app\model\user\UserEarningsModel;
use think\Request;

/**
 * UserEarnings 用户收益
 * Class UserEarnings
 * @package app\controller
 */
class UserEarnings extends BaseEncryptController
{
    protected function initialize()
    {
        parent::initialize();
        $this->model = new UserEarningsModel();
    }

    /**
     * 分页列表
     * @param int $user_id
     * @param int $page
     * @param int $limit
     * @return \think\response\Json
     */
    public function getPage($user_id = 0, $page = 1, $limit = 10)
    {
        $data = $this->model->getPageData($user_id, $page, $limit);
        return self::returnMsg(1, [
            'totalCount' => $data['total'],
            'currentPage' => $data['current'],
            'pageList' => $data['dataList']
        ]);
    }
}
